package xyz.xtt.user.client;

import java.util.Collection;
import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import jakarta.validation.Valid;
import jakarta.validation.constraints.Positive;
import xyz.xtt.common.response.ApiResult;
import xyz.xtt.pay.client.response.TblPayOrderDto;
import xyz.xtt.user.api.dto.TblUserFundRecordDto;
import xyz.xtt.user.api.dto.UpdateFundSettledRequest;
import xyz.xtt.user.client.request.UserRegRequest;
import xyz.xtt.user.client.response.UserInfoResponse;
import xyz.xtt.user.client.response.UserRegResponse;

@FeignClient(name = "nft-user", fallbackFactory = UserClientFallbackFactory.class)
public interface UserClient {
	/**
	 * 查询用户信息
	 */
	@GetMapping("/api/nft/user/info")
	ApiResult<UserInfoResponse> info(@RequestParam("appUid") Long appUid);

	/**
	 * 批量查询用户信息
	 */
	@GetMapping("/api/nft/user/batchInfo")
	ApiResult<List<UserInfoResponse>> batchInfo(@RequestParam("appUids") Collection<Long> appUids);

	/**
	 * 查询用户信息
	 */
	@GetMapping("/api/nft/user/infoWithPhone")
	ApiResult<UserInfoResponse> infoWithPhone(@RequestParam("phone") String phone);

	@PostMapping("/api/nft/user/register")
	ApiResult<UserRegResponse> register(@RequestBody UserRegRequest userRegRequest);

	/**
	 * 是否需要实名认证
	 * 
	 * @param uid
	 * @param authCheckFrequency
	 * @return
	 */
	@GetMapping("/api/nft/user/checkAuth")
	ApiResult<Boolean> checkAuth(@RequestParam("uid") String uid, @RequestParam("authCheckFrequency") Long authCheckFrequency);

	@GetMapping("/api/nft/user/fund/getNeedSettleRecords")
	ApiResult<List<TblUserFundRecordDto>> getNeedSettleRecords(@RequestParam("maxCount") @Positive Integer maxCount,
			@RequestParam(value = "lastId", required = false) Long lastId);

	@PostMapping("/api/nft/user/fund/updateFundSettled")
	ApiResult<Boolean> updateFundSettled(@RequestBody @Valid UpdateFundSettledRequest request);

	@PostMapping("/api/nft/user/fund/handleOrderPaySuccess")
	ApiResult<Boolean> handleOrderPaySuccess(@RequestBody TblPayOrderDto payOrderDto);
}
